/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.mappingmodel.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import uimigration.mappingmodel.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MappingtableFactoryImpl extends EFactoryImpl implements
		MappingtableFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static MappingtableFactory init() {
		try {
			MappingtableFactory theMappingtableFactory = (MappingtableFactory) EPackage.Registry.INSTANCE
					.getEFactory("http://mappingmodel/1.0");
			if (theMappingtableFactory != null) {
				return theMappingtableFactory;
			}
		} catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new MappingtableFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingtableFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
		case MappingtablePackage.MAPPING_TABLE:
			return createMappingTable();
		case MappingtablePackage.MAPPING_ACTION_EVENT:
			return createMappingActionEvent();
		case MappingtablePackage.MAPPING_BEHAVIOUR_EVENT:
			return createMappingBehaviourEvent();
		case MappingtablePackage.MAPPING_POSITION_PROPERTIES:
			return createMappingPositionProperties();
		case MappingtablePackage.EVENT:
			return createEvent();
		case MappingtablePackage.WIDGET_EVENT:
			return createWidgetEvent();
		default:
			throw new IllegalArgumentException("The class '" + eClass.getName()
					+ "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
		case MappingtablePackage.ACTION_TYPE:
			return createActionTypeFromString(eDataType, initialValue);
		case MappingtablePackage.BEHAVIOUR_TYPE:
			return createBehaviourTypeFromString(eDataType, initialValue);
		case MappingtablePackage.POSITION_TYPE:
			return createPositionTypeFromString(eDataType, initialValue);
		default:
			throw new IllegalArgumentException("The datatype '"
					+ eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
		case MappingtablePackage.ACTION_TYPE:
			return convertActionTypeToString(eDataType, instanceValue);
		case MappingtablePackage.BEHAVIOUR_TYPE:
			return convertBehaviourTypeToString(eDataType, instanceValue);
		case MappingtablePackage.POSITION_TYPE:
			return convertPositionTypeToString(eDataType, instanceValue);
		default:
			throw new IllegalArgumentException("The datatype '"
					+ eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingTable createMappingTable() {
		MappingTableImpl mappingTable = new MappingTableImpl();
		return mappingTable;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingActionEvent createMappingActionEvent() {
		MappingActionEventImpl mappingActionEvent = new MappingActionEventImpl();
		return mappingActionEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingBehaviourEvent createMappingBehaviourEvent() {
		MappingBehaviourEventImpl mappingBehaviourEvent = new MappingBehaviourEventImpl();
		return mappingBehaviourEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingPositionProperties createMappingPositionProperties() {
		MappingPositionPropertiesImpl mappingPositionProperties = new MappingPositionPropertiesImpl();
		return mappingPositionProperties;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Event createEvent() {
		EventImpl event = new EventImpl();
		return event;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WidgetEvent createWidgetEvent() {
		WidgetEventImpl widgetEvent = new WidgetEventImpl();
		return widgetEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionType createActionType(String literal) {
		ActionType result = ActionType.get(literal);
		if (result == null)
			throw new IllegalArgumentException("The value '" + literal
					+ "' is not a valid enumerator of '"
					+ MappingtablePackage.Literals.ACTION_TYPE.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionType createActionTypeFromString(EDataType eDataType,
			String initialValue) {
		return createActionType(initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertActionType(ActionType instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertActionTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BehaviourType createBehaviourType(String literal) {
		BehaviourType result = BehaviourType.get(literal);
		if (result == null)
			throw new IllegalArgumentException("The value '" + literal
					+ "' is not a valid enumerator of '"
					+ MappingtablePackage.Literals.BEHAVIOUR_TYPE.getName()
					+ "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BehaviourType createBehaviourTypeFromString(EDataType eDataType,
			String initialValue) {
		return createBehaviourType(initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertBehaviourType(BehaviourType instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertBehaviourTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PositionType createPositionType(String literal) {
		PositionType result = PositionType.get(literal);
		if (result == null)
			throw new IllegalArgumentException("The value '" + literal
					+ "' is not a valid enumerator of '"
					+ MappingtablePackage.Literals.POSITION_TYPE.getName()
					+ "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PositionType createPositionTypeFromString(EDataType eDataType,
			String initialValue) {
		return createPositionType(initialValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPositionType(PositionType instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPositionTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingtablePackage getMappingtablePackage() {
		return (MappingtablePackage) getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	public static MappingtablePackage getPackage() {
		return MappingtablePackage.eINSTANCE;
	}

} //MappingtableFactoryImpl
